package com.my


object XmlStudy {
  def main(args:Array[String]) {
    val str =
      """
        <books>
        	<book>
        		<name>Scala in Action</name>
        		<author>Gim Kun</author>
        		<price>100.00</price>
        	</book>
        	<book>
        		<name>C++ implementation</name>
        		<author>Unknown</author>
        		<price>99.00</price>
        	</book>
        </books>
      """
    val xml = scala.xml.XML.loadString(str)
    
    xml.\\("book").foreach 
    {
      f =>
      f.child.foreach 
      {
        c =>
        c match{
        //case s:scala.xml.Text => println(c)
        case s:scala.xml.Elem => println(c.attributes)
        case _ => 
      }
        
      }
    }
    
  }
}